﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

namespace SoftWareLab_Project
{
    public class login_class
    {
        public DataTable GetData(string U, string p)
        {
            DataTable dt = new DataTable();
            string sqltext = @"SELECT TB_USER.USER_NAME,TB_USER.PASSWORD,TB_USER.NAME,TB_USER.LASTNAME,TB_USER.P_TECHNICAL,TB_DEPARTMENT.NAME_DEPARTMENT,TB_USER.P_MANAGEMENT,TB_FACULTY.NAME_FACULTY ,TB_DEPARTMENT.ID_DEPARTMENT
                               FROM TB_USER INNER JOIN TB_DEPARTMENT ON TB_USER.ID_DEPARTMENT = TB_DEPARTMENT.ID_DEPARTMENT INNER JOIN TB_FACULTY ON TB_USER.ID_FACULTY = TB_FACULTY.ID_FACULTY
                               WHERE TB_USER.USER_NAME = '" +U+"' AND TB_USER.PASSWORD = '"+p+"'";
            string Connection = ConfigurationManager.ConnectionStrings["DB_EVALUATEConnectionString"].ConnectionString;
            SqlConnection sqlconn = new SqlConnection(Connection);
            SqlDataAdapter da = new SqlDataAdapter(sqltext, sqlconn);
            DataSet ds = new DataSet();
            da.Fill(ds);
            return ds.Tables[0];
        }
    }
}